Fix bug in height filter pointed out by Valerio Messina. height corrections should...
authortsteven4 <tsteven4@gmail.com>
Sun, 18 Dec 2016 23:38:00 +0000 (16:38 -0700)
committertsteven4 <tsteven4@gmail.com>
Sun, 18 Dec 2016 23:38:00 +0000 (16:38 -0700)
height.cc

index f03e6e7abd67144e91ea9e5d43a8906b7a833962..963cae6814dab5b4bf3132ae28e98cd10a7bff67 100644 (file)
--- a/height.cc
+++ b/height.cc
@@ -109,12 +109,14 @@ correct_height(const Waypoint* wpt)
 {
   Waypoint* waypointp = (Waypoint*) wpt;
 
-  if (addopt) {
-    waypointp->altitude += addf;
-  }
-
-  if (wgs84tomslopt) {
-    waypointp->altitude -= wgs84_separation(waypointp->latitude, waypointp->longitude);
+  if (waypointp->altitude != unknown_alt) {
+    if (addopt) {
+      waypointp->altitude += addf;
+    }
+  
+    if (wgs84tomslopt) {
+        waypointp->altitude -= wgs84_separation(waypointp->latitude, waypointp->longitude);
+    }
   }
 }